package servlet;

import javax.servlet.Servlet;

/**
 * This class is used to get the initialization parameters for the servlets. 
 * These are parameters common to all servlets, found in the contex-param 
 * blocks in the file web.xml.
 * @author jaime
 *
 */
public class ServletInitParams {
	
	/**
	 * Gets the type of factory to be used by services. This is obtained from the parameter
	 * ServiceFactoryType found in the web.xml.
	 * @param S - the instance of the servlet whose paramters are needed.
	 * @return the value of parameter ServiceFactoryType
	 */
	public static String getServiceFactoryType(Servlet S){
		String result = null;
		
		// Get the servlet configuration, then its context, and then the value of parameter ServiceFactoryType
		result = S.getServletConfig().getServletContext().getInitParameter("ServiceFactoryType");		
		return result;
		
	}

}
